package com.gosophia.conference.action.confPrepare;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.conferenceManagement.common.dto.DocumentDTO;
import com.gosophia.conferenceManagement.confPreparation.ws.ConfPreparationWebService;
import com.gosophia.oa.action.JudgeCurrentUndertaker;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 获取会议材料Action
 * @author wangxinbing
 * @since  2011-3-26
 *  Copyright (c) 2010 Gosophia corporation All Rights Reserved
 */
@Component("GetConferenceMaterialsAction")
@Scope("prototype")
public class GetConferenceMaterialsAction extends BaseSupportAction {
	@Autowired
	private ConfPreparationWebService confPreparationWebService;
	@Autowired
	private JudgeCurrentUndertaker judgeCurrentUndertaker;
	private List<DocumentDTO> materials = new ArrayList<DocumentDTO>();
	
	private Long jobId;
	

	public Long getJobId() {
		return jobId;
	}

	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}

	public List<DocumentDTO> getMaterials() {
		return materials;
	}

	public void setMaterials(List<DocumentDTO> materials) {
		this.materials = materials;
	}

	@Override
	public String _execute() throws Exception {
		//判断是否匹配,如果不匹配转到异常页面
        judgeCurrentUndertaker.judgeOperationAuthority(jobId);
        materials = confPreparationWebService.findMaterialsByJobId(jobId);
		return SUCCESS;
	}

	
}
